#include "matrix.h"
#include "gtest/gtest.h"

TEST(AddTest, AddingMatrices){
	TestMatrix a,b,c,d;

	a.mat[0][0] = 1;
	a.mat[0][1] = 2;
	a.mat[1][0] = 3;
	a.mat[1][1] = 4;

	b.mat[0][0] = 5;
	b.mat[0][1] = 6;
	b.mat[1][0] = 7;
	b.mat[1][1] = 8;

	c.mat[0][0] = 6;
	c.mat[0][1] = 8;
	c.mat[1][0] = 10;
	c.mat[1][1] = 12;

	EXPECT_EQ(d.add(a,b),c);
}

TEST(SubtractTest, SubtractingMatrices){
	TestMatrix a,b,c,d;

	a.mat[0][0] = 4;
	a.mat[0][1] = 9;
	a.mat[1][0] = 15;
	a.mat[1][1] = 20;

	b.mat[0][0] = 5;
	b.mat[0][1] = 12;
	b.mat[1][0] = 20;
	b.mat[1][1] = 23;

	c.mat[0][0] = 1;
	c.mat[0][1] = 3;
	c.mat[1][0] = 5;
	c.mat[1][1] = 3;

	EXPECT_EQ(d.sub(a,b),c);
}

TEST(MultiplyTest, MultiplyingMatrices){
	TestMatrix a,b,c,d;

	a.mat[0][0] = 1;
	a.mat[0][1] = 2;
	a.mat[1][0] = 3;
	a.mat[1][1] = 4;

	b.mat[0][0] = 5;
	b.mat[0][1] = 6;
	b.mat[1][0] = 7;
	b.mat[1][1] = 8;

	c.mat[0][0] = 19;
	c.mat[0][1] = 22;
	c.mat[1][0] = 43;
	c.mat[1][1] = 50;

	EXPECT_EQ(d.mul(a,b),c);
}
